var dataGridFobCost;
$(function(){
	dataGridFobCost = $('#dataGridFobCost').datagrid({
		title:var_title,
		iconCls:'icon-tip',
		nowrap: false,
		striped: true,
		queryParams:{}, //查询条件  
		url: contextPath + '/fobcost/chooseListFobCost.action',
		sortName: 'createTime',
		sortOrder: 'desc',
		loadMsg:var_loadMsg, 
		remoteSort: false,
		idField:'id',
		fitColumns:true,
		/*singleSelect: true,*/
		pagination:true,
        rownumbers:true,
        scrollbarSize:0,
		columns:[[
            {field:'ck',checkbox:true},
            {title:var_column_serialnumber,field:'id',width:35,sortable:true,
            	sorter:function(a,b){
					return (a>b?1:-1);
				}
            },
			{title:var_column_item,field:'item',width:50,sortable:true},
			{title:var_column_fobSize,field:'fobSize',width:50,sortable:true},
			{title:var_column_createUser,field:'createUser',width:50,sortable:true},
			{title:var_column_createTime,field:'createTime',width:50,sortable:true}
		]],
		onLoadSuccess:function(){ 
			//一定要加上这一句，要不然datagrid会记住之前的选择状态，删除时会出问题
			dataGridFobCost.datagrid('clearSelections');
		}  
	});
	
	$('#searchPanel').panel({  
		width:"100%",  
		height:"100%", 
		/*collapsible:true,*/
		title: var_search_title
	});  
	
    // 当窗口大小发生变化时，调整DataGrid的大小  
    $(window).resize(function() { 
    	$('#searchPanel').panel('resize',{width:$(document.body).width() - 10});
    	dataGridFobCost.resizeDataGrid(300);  
    });  
    
    //查询操作
    $("#queryFobCostBtn").click(function(){
        var queryFobCostForm = $("#queryFobCostForm").serializeArray();
		var queryParams = dataGridFobCost.datagrid('options').queryParams;
        $.each(queryFobCostForm, function(i, field){
            queryParams[field.name] = field.value;
        });
        //重新加载datagrid的数据  
        dataGridFobCost.datagrid('load');
    });
});
